using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    class Program
    {
        static void Main(string[] args)
        {
            Plane p = new Plane();
            Bird b = new Bird();
            Superman s = new Superman();
            p.Action();
            Console.WriteLine();
            b.Action();
            Console.WriteLine();
            s.Action();
            Console.WriteLine();
            Batmobile bm = new Batmobile();
            bm.Action();
            (bm as IFire)?.Fire();
        }
    }

    interface IFlyable
    {
        void TakeOff();
        void Fly();
        void Land();
        void Action();
    }

    interface IFire
    {
        void Fire();
    }
    interface IAnimal
    {
        void Eat();
    }

    interface IVehicle
    {
        void CarryPassange();
    }

    class Batmobile : IVehicle, IFlyable,IFire
    {
        public void Action()
        {
            Fly();
            Land();
            TakeOff();
            CarryPassange();
        }

        public void CarryPassange()
        {
            Console.WriteLine("Batmobile is carrying passanger");
        }

        public void Fly()
        {
            Console.WriteLine("Batmobile is flying");
        }

        public void Land()
        {
            Console.WriteLine("Batmobile is landing");
        }

        public void TakeOff()
        {
            Console.WriteLine("Batmobile is taking off");
        }

        void IFire.Fire()
        {
            Console.WriteLine("Batmobile is firing");
        }
    }

    class Bird : IAnimal, IFlyable
    {
        public void Fly()
        {
            Console.WriteLine("bird is flying");
        }

        public void Land()
        {
            Console.WriteLine("bird is landing");
        }

        public void TakeOff()
        {
            Console.WriteLine("bird is taking off");
        }

        public void LayEggs()
        {
            Console.WriteLine("bird is laying eggs");
        }

        public void Action()
        {
            Fly();
            Land();
            TakeOff();
            LayEggs();
            Eat();
        }

        public void Eat()
        {
            Console.WriteLine("bird is eating");
        }
    }

    class Superman : IAnimal, IFlyable
    {
        public void Action()
        {
            Eat();
            Fly();
            Land();
            TakeOff();
        }

        public void Eat()
        {
            Console.WriteLine("superman is eating");
        }

        public void Fly()
        {
            Console.WriteLine("superman is flying");
        }

        public void Land()
        {
            Console.WriteLine("superman is landing");
        }

        public void TakeOff()
        {
            Console.WriteLine("superman is taking off");
        }
    }


    class Plane : IVehicle, IFlyable
    {
        public void Action()
        {
            CarryPassange();
            Fly();
            Land();
            TakeOff();
        }

        public void CarryPassange()
        {
            Console.WriteLine("plane is carrying passanger");
        }

        public void Fly()
        {
            Console.WriteLine("plane is flying");
        }

        public void Land()
        {
            Console.WriteLine("plane is landing");
        }

        public void TakeOff()
        {
            Console.WriteLine("plane is taking off");
        }
    }
}
